import {createRouter, createWebHashHistory} from "vue-router"
import login from '@/views/Login.vue'
import home from '@/views/Home.vue'
import workprotecttable from '@/components/labor/WorkProtectTable.vue'
import AddLabor from '@/components/labor/AddLabor.vue'
import StaffManagement from '@/components/StaffManagement.vue'
import Config from '@/components/Config.vue'
import ClassWriteStatusManagement from '@/components/ClassWriteStatusManagement.vue'
import AgingManagement from '@/components/AgingManagement.vue'
import About from '@/components/About.vue'
import AddCertificate from '@/components/certificate/AddCertificate.vue'
import lowTensionTable from '@/components/lowtension/lowTensionTable.vue'
import highplaceTable from '@/components/highplace/highplaceTable.vue'

const routes = [
    {
        path: '/',
        name: 'login',
        component: login
    },
    {
        path: '/home',
        name: 'home',
        meta: { requiresAuth: true },
        component: home,
        redirect: to => {
            return { path: '/home/About'}
        },
        children: [
            //校验劳保用品
            {
                name: 'About',
                path: 'About',
                component: About,
                meta: { requiresAuth: true },
            },
            //校验劳保用品
            {
                name: 'workprotecttable',
                path: 'workprotecttable',
                component: workprotecttable,
                meta: { requiresAuth: true },
            },
            //校验低压电工证
            {
                name: 'lowTensionTable',
                path: 'lowTensionTable',
                component: lowTensionTable,
                meta: { requiresAuth: true },
            },
            //校验高处证
            {
                name: 'highplaceTable',
                path: 'highplaceTable',
                component: highplaceTable,
                meta: { requiresAuth: true },
            },
            //配置
            {
                name: 'Config',
                path: 'Config',
                component: Config,
                meta: { requiresAuth: true },
            },
            //员工管理
            {
                name: 'StaffManagement',
                path: 'StaffManagement',
                component: StaffManagement,
                meta: { requiresAuth: true },
            },
            //修改工班填写权限
            {
                name: 'ClassWriteStatusManagement',
                path: 'ClassWriteStatusManagement',
                component: ClassWriteStatusManagement,
                meta: { requiresAuth: true },
            },
            //添加劳保用品
            {
                name: 'AddLabor',
                path: 'AddLabor',
                component: AddLabor,
                meta: { requiresAuth: true ,requiresAddPermission:true},
            },
            //添加低压电工
            {
                name: 'AddLowVoltage',
                path: 'AddLowVoltage',
                component: AddCertificate,
                meta: { requiresAuth: true ,requiresAddPermission:true},
            },            //添加低压电工
            //时效管理
            {
                name: 'AgingManagement',
                path: 'AgingManagement',
                component: AgingManagement,
                meta: { requiresAuth: true ,requiresAddPermission:true},
            },
        ]
    },
]


const router = createRouter({
    history: createWebHashHistory(),
    routes,
})

export default router
